// MdiClient.cpp : implementation file
//
#include "stdafx.h"
#include "GameBrowserMdiClient.h"
#include "GameBrowserNavigationBar.h"
///////////////////////////////////////////////////////////////////////////////
// CGameBrowserMdiClient
IMPLEMENT_DYNAMIC(CGameBrowserMdiClient,CWnd)

CGameBrowserMdiClient::CGameBrowserMdiClient()
{
    m_pNavigateBar = NULL;
}

CGameBrowserMdiClient::~CGameBrowserMdiClient()
{
}


// ---------------------------------------------------------------------------
// Message Map
// ---------------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CGameBrowserMdiClient, CWnd)
    //{{AFX_MSG_MAP(CGameBrowserMdiClient)
    ON_MESSAGE(WM_MDICREATE,OnMDICreate)
    ON_MESSAGE(WM_MDIDESTROY,OnMDIDestroy)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CGameBrowserMdiClient::SetNavigateBar(CGameBrowserNavigationBar *pBar)
{
    m_pNavigateBar = pBar;
}
/////////////////////////////////////////////////////////////////////////////
// On Document Open,New

LRESULT CGameBrowserMdiClient::OnMDICreate(WPARAM wParam, LPARAM lParam)
{
    HWND hWnd = (HWND) DefWindowProc(WM_MDICREATE,  wParam, lParam);
    MDICREATESTRUCT *mcs = (MDICREATESTRUCT*)(lParam);
    if(m_pNavigateBar != NULL)
    {
			
		m_pNavigateBar->OnMDIChildCreate(hWnd);

    }
    //::ShowWindow(hWnd,SW_SHOWMAXIMIZED);
    return (LRESULT) hWnd;
}

//
//On document close
//
LRESULT CGameBrowserMdiClient::OnMDIDestroy(WPARAM wParam, LPARAM lParam)
{
    HWND hWnd = (HWND) wParam;
    if(m_pNavigateBar != NULL)
    {
        m_pNavigateBar->OnMDIChildDestory(hWnd);
    }
    return DefWindowProc(WM_MDIDESTROY,  wParam, lParam);
}